function [Signal_Indication, First_Detection] = Function_Dection_Windowed_FFT(Signal, Window, FFT_Size, Window_Theo)
    Data_Length = length(Signal);
    Max_Block_Number = floor(Data_Length / FFT_Size);
    Store_FFT_Result = zeros(Max_Block_Number,1);
    Store_Signal_Indication = zeros(Max_Block_Number,1);
    First_Detection = 0;
    
    % Detect signal use FFT template
    for Process_Index = 1:Max_Block_Number
        Temp_Data = Signal((Process_Index - 1)*FFT_Size + 1:Process_Index*FFT_Size);
        Signal_FFT = abs(fft(Temp_Data)); %calculate power
        Sum_Signal = 0;
        Sum_Noise = 0;
        for n = 1:FFT_Size
            Sum_Signal = Sum_Signal + Signal_FFT(n) * Window(n);
            Sum_Noise = Sum_Noise - Signal_FFT(n) * (Window(n)-1);
        end
        Sum_Signal = Sum_Signal / sum(Window);
        Sum_Noise = Sum_Noise / (FFT_Size - sum(Window));

        SNR_Ratio = Sum_Signal / Sum_Noise;
        Store_FFT_Result(Process_Index) = SNR_Ratio;
        
        if(SNR_Ratio>Window_Theo)
            % If SNR is larger than Theo, mark 1 with
            % Store_Signal_Indication and give the index of First_Detection
            Store_Signal_Indication(Process_Index) = 1;
            if(First_Detection == 0)
                First_Detection = Process_Index;
            end
        end
    end
    
    if(First_Detection>0)
        % Detect signal
        if(First_Detection<Max_Block_Number-1)
            if(sum(Store_Signal_Indication(First_Detection:First_Detection+2)) == 3)
                % If all 3 consecutive frames are signals, the signal is determined to be detected
                Signal_Indication = 1;
            else
                % May be noise detected
                Signal_Indication = -1;
            end
        else
            % In this frame, the number of detected signal windows is less
            % than 3. Mark 0 for Signal_Indication. Need next detection
            Signal_Indication = 0;
        end
    else
        % No signal detected
        Signal_Indication = -1;
    end